import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from "axios"
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import "@/assets/css/reset.css";
import TreeTable from "vue-table-with-tree-grid"
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)
Vue.component("TreeTable",TreeTable)

//全局过滤器
Vue.filter("getdate",function(value){
  let date = new Date(value*1000);
  let y = date.getFullYear(),
      m = date.getMonth()+1,
      d = date.getDate(),
      h = date.getHours(),
      M = date.getMinutes(),
      s  = date.getSeconds()
  return `${y}-${m.toString().padStart(2,0)}-${d.toString().padStart(2,0)} ${h.toString().padStart(2,0)}:${M.toString().padStart(2,0)}:${s.toString().padStart(2,0)}`
})
//设置axios拦截器,拦截token,并设置上header
axios.interceptors.request.use(config=>{
  config.headers.Authorization = window.sessionStorage.getItem("token")
  return config
},
err=>{
  console.log(err)
})
//登录注册的接口
axios.defaults.baseURL="http://localhost:8081";
//内容部分的接口
//http://timemeetyou.com:8889/api/private/v1/
Vue.prototype.$axios = axios;
Vue.use(ElementUI)
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
